package com.by.service.impl;

import com.by.bean.Order.Order;
import com.by.bean.OrderDetail;
import com.by.bean.OrderLog;
import com.by.bean.OrderQueryCriteria;
import com.by.common.core.bean.PageBean;
import com.by.common.core.crud.BaseServiceImpl;
import com.by.mapper.OrderMapper;
import com.by.remote.system.SgoodsRemote;
import com.by.service.OrderService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl extends BaseServiceImpl<Order, OrderMapper> implements OrderService {

    @Autowired
    OrderMapper orderMapper;

    @Autowired
    SgoodsRemote sgoodsRemote;

    @Override
    public PageBean queryOrderList(OrderQueryCriteria orderQueryCriteria)  {
        PageHelper.startPage(orderQueryCriteria.getPage(),orderQueryCriteria.getPageSize());
        List list=orderMapper.queryOrderList(orderQueryCriteria);
        PageInfo info=new PageInfo<>(list);
        return new PageBean<>(orderQueryCriteria.getPage(),orderQueryCriteria.getPageSize(),info.getTotal(),list);
    }

    @Override
    public List<OrderLog> queryOrderLog(String orderSn) {
        return orderMapper.queryOrderLog(orderSn);
    }

    @Override
    public Order queryOrderByCode(String code) {
        return orderMapper.queryOrderByCode(code);
    }

    @Override
    public OrderDetail queryOrderDetailByCode(String code) {
        OrderDetail orderDetail = orderMapper.queryOrderDetailByCode(code);
        return null;
    }
}
